package com.example.ime_demo

import android.inputmethodservice.InputMethodService
import android.view.LayoutInflater
import android.view.View
import com.example.ime_demo.databinding.LayoutInputViewBinding

class IMEService : InputMethodService() {

    private var clickCount = 0

    private var _binding: LayoutInputViewBinding? = null
    private val binding: LayoutInputViewBinding get() = _binding!!

    override fun onCreateInputView(): View {
        _binding = LayoutInputViewBinding.inflate(LayoutInflater.from(this))
        binding.btnInput.setOnClickListener {
            clickCount++
            currentInputConnection.commitText(" 输入$clickCount", 1)
        }
        return binding.root
    }

}